﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="FctHierarchy.aspx.vb" Inherits="FctHierarchy" %>

<%@ Register Assembly="ISNet.WebUI.WebInput" Namespace="ISNet.WebUI.WebControls" TagPrefix="ISWebInput" %>

<%@ Register Assembly="ISNet.WebUI.WebTreeView" Namespace="ISNet.WebUI.WebTreeView" TagPrefix="ISWebTreeView" %>

<%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %>

<%@ Register Assembly="ISNet.WebUI.WebCombo" Namespace="ISNet.WebUI.WebCombo" TagPrefix="ISWebCombo" %>

<%@ Register Assembly="ISNet.WebUI.WebDesktop" Namespace="ISNet.WebUI.WebDesktop" TagPrefix="ISWebDesktop" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <link href="script/style.css" rel="stylesheet" />
    <script src="script/tinybox.js"></script>
     <asp:ScriptManager ID="Scriptmanager1" runat="server">
    </asp:ScriptManager>

    <div style="float: left; width: 97%; border: solid; border-color: gray; border-width: 1px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; box-shadow: 5px 5px 5px #808080; text-align: right; padding: 5px 5px 5px 5px;">
        <div style="text-align: right; margin-top: 5px;">
            <div align="left" style="width: 600px; float: left">
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>s
            </div>
            <script>
                function closeJS() {
                    var WebGrid1 = ISGetObject("WebGrid1");
                    WebGrid1.Refresh();
                    var WebCombo1 = ISGetObject("WebCombo1");
                    WebCombo1.LoadValue();
                }
                function addclick() {
                    var pytxt = document.getElementById('<%=PlanYearsTxt.ClientID%>').value
                    var gptxt = document.getElementById('<%=GroupTextBox.ClientID%>').value
                    var grid = ISGetObject("WebGrid1");
                    var row = grid.GetSelectedObject().GetRowObject();

                    TINY.box.show({ iframe: 'FctHierarchy_Add.aspx?FctCode=' + row.KeyValue + '&PlanYear=' + pytxt + '&Group=' + gptxt, boxid: 'frameless', width: 630, height: 300, fixed: false, maskid: 'lightmask', maskopacity: 40, closejs: function () { closeJS() } });
                }
                function CustomRequest() {
                    if (confirm('กรุณายืนยันการลบข้อมูล') == false) {
                        return false
                    }
                    var grid = ISGetObject("WebGrid1");
                    grid.SendCustomRequest();
                    return true;
                }
                function RegenConfirm() {
                    if (confirm('กรุณายืนยันการปรับรายการ') == false) {
                        return false
                    }
                    popupwait();
                    return true;
                }
                function popupwait() {
                    TINY.box.show({ iframe: 'loading.html', boxid: 'frameless',close: 0, width: 300, height: 260, fixed: false, maskid: 'lightmask', maskopacity: 40, closejs: function () { closeJS() } });
                    var importbtn = document.getElementById("<%= RegenBtn.ClientID%>");
                        importbtn.style.display = "none";
                    }
            </script>
            <div style="float: right;">

                <table>
                    <tr>
                        <td>ประเภทกลุ่ม</td>
                        <td>
                            <asp:TextBox ID="GroupTextBox" runat="server" Width="50px" Text="1"></asp:TextBox></td>
                        <td>Root Fund Center</td>
                        <td>
                            <ISWebCombo:WebCombo ID="WebCombo1" runat="server" UseDefaultStyle="True" DataTextField="Description" DataValueField="FundCenter_FundCenterCode" Height="20px" Width="330px" OnInitializeDataSource="WebCombo1_InitializeDataSource" AdditionalSearchFields="FundCenter_FundCenterCode" DropDownRows="100000" AllowWildCardSearch="true" >
                                <LayoutSettings AlwaysShowAllRowsOnDropdown="true" AlwaysShowHelpButton="false" EntryMode="AutoComplete" ComboMode="MultipleColumns">
                                </LayoutSettings>
                                <Columns>
                                    <ISWebCombo:WebComboColumn BaseFieldName="Description" Name="Description" HeaderText="ชื่อ FundCenter" Width="250px" />
                                    <ISWebCombo:WebComboColumn BaseFieldName="FundCenter_FundCenterCode" Name="FundCenter_FundCenterCode" HeaderText="รหัส FundCenter" Width="80px" />
                                </Columns>
                            </ISWebCombo:WebCombo>

                        </td>
                        <td>ปี&nbsp;</td>
                        <td>
                            <asp:TextBox ID="PlanYearsTxt" runat="server" Width="50px" Style="text-align: center;" AutoPostBack="true"></asp:TextBox></td>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;<asp:ImageButton ID="SearhBtn" runat="server" ImageUrl="Icons/search.jpg" ToolTip="แสดงโครงสร้างหน่วยงานตามเงื่อนไขที่ระบุ" />&nbsp;&nbsp;<asp:ImageButton ID="RegenBtn" runat="server" ImageUrl="Icons/regen.png" ToolTip="ปรับรายการแสดงโครงสร้างหน่วยงานตามที่ได้บันทึกไว้" OnClientClick="RegenConfirm()" />
                        </td>
                    </tr>
                </table>
               
            </div>

        </div>
    </div>

   

    <div style="float: left; width: 100%">
        <table width="100%">
            <tr>
                <td align="center">
                    <ISWebGrid:WebGrid ID="WebGrid1" runat="server" UseDefaultStyle="True" Width="730px" DefaultStyleMode="Silver" Height="500px" OnInitializePostBack="WebGrid1_InitializePostBack">
                        <LayoutSettings>
                        </LayoutSettings>
                        <RootTable DataKeyField="FundCenterCode">
                            <SelfReferencingSettings ChildDataMember="ParentCode" Enabled="True" ExpandColumnMember="Description"
                                ParentDataMember="FundCenterCode" />
                            <Columns>
                                <ISWebGrid:WebGridColumn Name="Description" Width="600px" Caption="Name" DataMember="Description">
                                    <HeaderStyle HorizontalAlign="Center" Width="600px" />
                                    <CellStyle HorizontalAlign="Left" />

                                </ISWebGrid:WebGridColumn>



                                <ISWebGrid:WebGridColumn Name="Action" Width="100px" Caption=" " DataMember="" ColumnType="Template">
                                    <CellTemplate>

                                        <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Icons/ic_new.png" OnClientClick="addclick(); return false;" ToolTip="เพิ่มหน่วยงานใต้สังกัด" />
                                        <asp:ImageButton ID="delete_btn" runat="server" ImageUrl="~/Icons/ic_delete.png" OnClientClick="CustomRequest(); return false" ToolTip="ลบหน่วยงานและหน่วยงานใต้สังกัด" />

                                    </CellTemplate>
                                    <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    <CellStyle HorizontalAlign="Right" />
                                </ISWebGrid:WebGridColumn>
                            </Columns>
                        </RootTable>

                    </ISWebGrid:WebGrid>

                </td>
            </tr>
        </table>

    </div>

    <%= sripttext%>
</asp:Content>

